<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>查留言</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/show.css">
</head>
<body>
    <main id="container">
        <div class="line1">
            <div class="mlogo"></div>
            <p class="t">看看有没有关于你的小秘密吧</p>
        </div>
		<div class="input-container">
		    <input class="cx" id="un" maxlength="12"/>
		    <div class="emm" onclick="aj();">查询</div>
		</div>
        <div class="line2" id="line2"></div>
    </main>
<script>
function setMaxWidth() {
  	            var container = document.getElementById('container');
  	            if (window.innerWidth > 400) {
  	                container.style.maxWidth = '400px';
  					var leftMargin = (window.innerWidth - 400) / 2;
  					container.style.marginLeft = leftMargin + 'px';
  	            } else {
  	                container.style.maxWidth = 'none';
  					container.style.marginLeft = 'none';
  	            }
  	        }
  	
  	        // 初始化时调用一次，并在窗口大小改变时触发
  	        setMaxWidth();
  	        window.addEventListener('resize', setMaxWidth);
	let aj = function (){
    let n=document.getElementById("un").value;
    let xmlhttp;
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
      {
        document.getElementById("line2").innerHTML = xmlhttp.responseText;
      }
    }
    xmlhttp.open("GET","select.php?n="+n,true);
    xmlhttp.send();
  }
  
  	
</script>
</body>
</html>